<?php
//dezend by http://www.yunlu99.com/ QQ:270656184
defined('BASEPATH') || exit('No direct script access allowed');
?>
  <div class="user-body">
  	<div class="body-content">
      <div class="item-step">
      	<label <?php
if (isset($step) && ($step == 0)) {
?>class="on"<?php
}

?>>项目基本信息</label>
      	<i class="fa fa-caret-right"></i>
      	<label <?php
if (isset($step) && ($step == 1)) {
?>class="on"<?php
}

?>>项目详细介绍</label>
      	<i class="fa fa-caret-right"></i>
      	<label <?php
if (isset($step) && ($step == 2)) {
?>class="on"<?php
}

?>>设置投资回报</label>
      	<i class="fa fa-caret-right"></i>
      	<label <?php
if (isset($step) && ($step == 3)) {
?>class="on"<?php
}

?>>提交审核</label>
      	<div class="clear"></div>
      </div>
      
      <div class="info">
      	<?php
if (!isset($step) || ($step == 0)) {
?>      	<form action="<?php echo site_url('item_add/save1');?>" method="post" id="form_id" class="money-form">
        	<table cellspacing=0 cellpadding=0 border=0>
			  <tr><th>项目名称：</th><td><input type="text" name="name" must="1"><p>请输入项目名称</p></td></tr>
			  <tr><th>项目简介：</th><td><input type="text" name="intro" must="1"><p>请输入项目简介</p></td></tr>
			  <tr><th>项目天数：</th><td><input type="text" name="day" must="1"><p>请输入项目周期</p></td></tr>
			  <tr><th>开始时间：</th><td><input type="text" name="begin" readonly must="1"><p>请输入开始时间</p></td></tr>
			  <tr><th>结束时间：</th><td><input type="text" name="end" readonly must="1"><p>请输入结束时间</p></td></tr>
			  <tr><th>项目LOGO：</th>
			  	  <td>
					<div id="logo_view" class="upload_view"></div>
					<input type="hidden" name="logo" id="logo_value">
					<input type="file" id="logo">
				  </td>
			  </tr>
			  <tr><th>项目图片：</th>
			  	  <td>
					<div id="img_view" class="upload_view"></div>
					<input type="hidden" name="img" id="img_value">
					<input type="file" id="img">
				  </td>
			  </tr>
			  <tr><th></th><td class="warning"></td></tr>
    		  <tr><th></th><td><button type="submit">保存，下一步</button></td></tr>
			</table>
		</form>
		<script type="text/javascript">
		$(function(){
			$('[name="begin"]').datepicker();
			$('[name="end"]').datepicker();
			$("#logo").upload('<?php echo site_url('item_add/upload');?>','/upload/item/', '请上传项目LOGO');
			$("#img").upload('<?php echo site_url('item_add/upload');?>','/upload/item/', '请上传项目展示图');
		});
		</script>
		<?php
}
else if ($step == 1) {
?>		<form action="<?php echo site_url('item_add/save2');?>" method="post" id="form_id" class="money-form">
			<input type="hidden" name="id" value="<?php echo $id;?>">
        	<table cellspacing=0 cellpadding=0 border=0>
			  <tr><th>详细介绍：</th><td><textarea name="content" cols=150 rows=30></textarea><p>请输入详细介绍</p></td></tr>
			  <tr><th></th><td class="warning"></td></tr>
    		  <tr><th></th><td><button type="submit">保存，下一步</button></td></tr>
			</table>
		</form>
		<link rel="stylesheet" href="/static/plugin/kindeditor/themes/default/default.css" />
		<script charset="utf-8" src="/static/plugin/kindeditor/kindeditor-min.js"></script>
		<script charset="utf-8" src="/static/plugin/kindeditor/lang/zh_CN.js"></script>

		<script language="javascript">
		$(function(){
			KindEditor.create('[name="content"]', {
				resizeArt : 1,
				allowPreviewEmoticons : false,
				allowImageUpload : true,
				afterBlur: function(){this.sync();},
				items : [
					'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
					'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
					'insertunorderedlist', '|', 'image', 'link']
		    });
		});
		</script>
		<?php
}
else if ($step == 2) {
?>		<form action="<?php echo site_url('item_add/save3');?>" method="post" id="form_id" class="money-form">
			<input type="hidden" name="id" value="<?php echo $id;?>">
        	<table cellspacing=0 cellpadding=0 border=0>
        	  
			  <tr><th>资金类型：</th>
				  <td>
				  <select name="coin_id">
				  
<?php
	foreach ($coins as $v) {
?>				  <option value="<?php echo $v['id'];?>"><?php echo $v['en_name'];?></option>
				  <?php
	}

?>				  </select>
				  </td>
			  </tr>
			  <tr><th>目标金额：</th><td><input type="text" name="target_amount" must="1"><p>请输入目标金额</p></td></tr>
			  <tr><th>允许超额：</th><td><input type="radio" name="is_over" value="0" checked> 否   <input type="radio" name="is_over" value="1"> 是 </td></tr>
			  <tr><th>允许锁定投资：</th><td><input type="radio" name="is_lock" value="0" checked> 否   <input type="radio" name="is_lock" value="1"> 是 </td></tr>
			  <tr><th>锁定后允许投资：</th><td><input type="radio" name="is_lock_support" value="0" checked> 否   <input type="radio" name="is_lock_support" value="1"> 是 </td></tr>
			    
			  <tr><th>代币名称：</th><td>
			    <select name="db_id">
				
<?php
	foreach ($db_coins as $v) {
?>				<option value="<?php echo $v['id'];?>"><?php echo $v['en_name'];?></option>
				<?php
	}

?>				</select>
			  </td></tr>
        	  <tr><th>代币总量：</th><td><input type="text" name="db_total" must="1"><p>请输入代币总量</p></td></tr>
        	  <tr><th>兑换比率：</th><td>1 代币 = <input type="text" name="db_rate" must="1" style="width:90px;"> <span id="coin_name" style="font-size:15px;"><?php echo $coins[0]['en_name'];?></span><p>请输入兑换比率</p></td></tr>
			  
			  <tr><th>回报周期：</th><td><input type="text" name="repay_day" must="1" placeholder="天数"><p>请输入回报周期</p></td></tr>
			  <tr><th>项目白皮书：</th>
			  	  <td>
					<div id="book_view" class="upload_view"></div>
					<input type="hidden" name="book" id="book_value">
					<input type="file" id="book">
				  </td>
			  </tr>
			  <tr><th></th><td class="warning"></td></tr>
    		  <tr><th></th><td><button type="submit">保存，下一步</button></td></tr>
			</table>
		</form>
		<script type="text/javascript">
		$(function(){
			$('[name="coin_id"]').change(function(){
				var txt = $(this).children(':selected').text();
				$('#coin_name').text(txt);
			});
			$("#book").upload_file('<?php echo site_url('item_add/upload');?>','/upload/item/', '请上传项目白皮书');
		});
		</script>
		<?php
}
else if ($step == 3) {
?>		<form action="<?php echo site_url('item_add/submit');?>" method="post" id="form_id" class="money-form">
		<input type="hidden" name="id" value="<?php echo $id;?>">
		<table cellspacing=0 cellpadding=0 border=0>
			  <tr><th>项目LOGO：</th><td><img src="/upload/item/<?php echo $logo;?>"></td></tr>
			  <tr><th>项目展示图：</th><td><img src="/upload/item/<?php echo $img;?>"></td></tr>
			  <tr><th>项目名称：</th><td><?php echo $name;?></td></tr>
			  <tr><th>项目简介：</th><td><?php echo $intro;?></td></tr>
			  <tr><th>项目周期：</th><td><?php echo $day;?></td></tr>
			  <tr><th>开始时间：</th><td><?php echo date('Y-m-d H:i:s', $begin);?></td></tr>
			  <tr><th>结束时间：</th><td><?php echo date('Y-m-d H:i:s', $end);?></td></tr>
			  <tr><th>目标金额：</th><td><?php echo $target_amount;?></td></tr>
			  <tr><th>允许超额：</th><td>
<?php
	if ($is_over == 0) {
?>否<?php
	}
	else {
?>是<?php
	}

?></td></tr>
			  <tr><th>允许锁定投资：</th><td>
<?php
	if ($is_lock == 0) {
?>否<?php
	}
	else {
?>是<?php
	}

?></td></tr>
			  <tr><th>锁定后允许投资：</th><td>
<?php
	if ($is_lock_support == 0) {
?>否<?php
	}
	else {
?>是<?php
	}

?></td></tr>
			  <tr><th>资金类型：</th><td><?php echo $coin['en_name'];?></td></tr>
			  <tr><th>回报周期：</th><td><?php echo $repay_day;?> 天</td></tr>
			  
			  <tr><th>代币名称：</th><td><?php echo $db_coin['en_name'];?> </td></tr>
			  <tr><th>代币总量：</th><td><?php echo $db_total;?> </td></tr>
			  <tr><th>兑换比率：</th><td>1 <?php echo $db_coin['en_name'];?> = <?php echo $db_rate;?> <?php echo $coin['en_name'];?></td></tr>
			  
			  <tr><th>项目白皮书：</th><td><?php echo $book;?></td></tr>
			  <tr><th>详细介绍：</th><td><?php echo $content;?></td></tr>
    		  <tr><th></th><td><button type="submit">提交审核</button></td></tr>
		</table>
		</form>
		
		<?php
}
else if ($step == 4) {
?>		<h1 style="text-align:center;margin:100px;font-size:15px;">该项目正在审核中。。。</h1>
		<?php
}

?>      </div>
      
    </div>
  </div>
  <div class="clear"></div>
</div>
<script>
$(function(){
$('#form_id').checkForm();
});
</script>